/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DataSpacePanel.java
 *
 * Created on 2010-9-28, 18:18:17
 */
package dataanalysis.gui.statisticPanel;

import java.awt.BorderLayout;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import weka.gui.visualize.VisualizePanel;

/**
 *
 * @author Administrator
 */
public class DataSpacePanel extends VisualizePanel {

    /** Creates new form DataSpacePanel */
    public DataSpacePanel() {
        super();
        initComponents();
        initVisualizePanel();
        m_plotPanel.setLayout(new BorderLayout());
        m_plotPanel.add(m_plotSurround);
        m_jitterPanel.setLayout(new BorderLayout());
        m_jitterPanel.add(m_Jitter);
        m_XCombPanel.setLayout(new BorderLayout());
        m_XCombPanel.add(m_XCombo);
        m_YCombPanel.setLayout(new BorderLayout());
        m_YCombPanel.add(m_YCombo);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        m_plotPanel = new javax.swing.JPanel();
        m_jitterPanel = new javax.swing.JPanel();
        m_YCombPanel = new javax.swing.JPanel();
        m_XCombPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        javax.swing.GroupLayout m_plotPanelLayout = new javax.swing.GroupLayout(m_plotPanel);
        m_plotPanel.setLayout(m_plotPanelLayout);
        m_plotPanelLayout.setHorizontalGroup(
            m_plotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 654, Short.MAX_VALUE)
        );
        m_plotPanelLayout.setVerticalGroup(
            m_plotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 394, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout m_jitterPanelLayout = new javax.swing.GroupLayout(m_jitterPanel);
        m_jitterPanel.setLayout(m_jitterPanelLayout);
        m_jitterPanelLayout.setHorizontalGroup(
            m_jitterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 238, Short.MAX_VALUE)
        );
        m_jitterPanelLayout.setVerticalGroup(
            m_jitterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 34, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout m_YCombPanelLayout = new javax.swing.GroupLayout(m_YCombPanel);
        m_YCombPanel.setLayout(m_YCombPanelLayout);
        m_YCombPanelLayout.setHorizontalGroup(
            m_YCombPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 150, Short.MAX_VALUE)
        );
        m_YCombPanelLayout.setVerticalGroup(
            m_YCombPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 34, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout m_XCombPanelLayout = new javax.swing.GroupLayout(m_XCombPanel);
        m_XCombPanel.setLayout(m_XCombPanelLayout);
        m_XCombPanelLayout.setHorizontalGroup(
            m_XCombPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 150, Short.MAX_VALUE)
        );
        m_XCombPanelLayout.setVerticalGroup(
            m_XCombPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 34, Short.MAX_VALUE)
        );

        jLabel1.setText("Jitter:");

        jLabel2.setText("X:");

        jLabel3.setText("Y:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(m_plotPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(m_jitterPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(m_XCombPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(m_YCombPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(m_plotPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER, false)
                    .addComponent(m_jitterPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(m_XCombPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(m_YCombPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel m_XCombPanel;
    private javax.swing.JPanel m_YCombPanel;
    private javax.swing.JPanel m_jitterPanel;
    private javax.swing.JPanel m_plotPanel;
    // End of variables declaration//GEN-END:variables

    private void initVisualizePanel() {
        this.removeAll();
        MouseListener[] plotMouseListeners = m_plot.getMouseListeners();
        MouseMotionListener[] plotMouseMotionListener = m_plot.getMouseMotionListeners();
        MouseListener[] clsssMouseListeners = m_classPanel.getMouseListeners();
        for (int i = 0; i < plotMouseListeners.length; i++) {
            m_plot.removeMouseListener(plotMouseListeners[i]);
        }
        for (int i = 0; i < plotMouseMotionListener.length; i++) {
            m_plot.removeMouseMotionListener(plotMouseMotionListener[i]);
        }
        for (int i = 0; i < clsssMouseListeners.length; i++) {
            m_classPanel.removeMouseListener(clsssMouseListeners[i]);
        }
    }
}

